GBML manual / Link Cable

link_button_released

True this frame if player `player` (1 to 4) has button `b` released (the frame it went up) - the same question as btn_released, about any player on the link cable. Asking about your own player number reads your own buttons, so one piece of code can serve every player. A player who is not there, or a number that is not a player, is simply false.

Works differently on Game Boy - The Game Boy link cable joins two consoles, not four: players 3 and 4 are never there and read as not pressing anything, and the two consoles decide between themselves which one is player 1, so it can be a different one each time they meet.

Works differently on Game Boy Color - The Game Boy Color link cable joins two consoles, not four: players 3 and 4 are never there and read as not pressing anything, and the two consoles decide between themselves which one is player 1, so it can be a different one each time they meet.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

link_button_released(player, b) -> bool

Arguments

NameType
playerint
bbutton

Returns

bool

Description

True on the one frame player player (1 to 4) lets go of button b. It is the question btn_released asks, about any player on the link cable. Use it for something that ends when the button does: stopping a run, firing a charged shot.

When a player disappears from the cable, every button they were holding is released, once, on that frame. A game that does something "while the button is held" therefore always gets the chance to stop doing it. After that frame every question about the missing player is false.

Example

if (link_button_released(1, BTN_B)) {
    hsp = 0;
}

Stops moving when player 1 lets go of B, including when player 1's cable was pulled out while B was down.

On the GBA

Players are numbered 1 to 4 by where they sit on the cable, and player 1 is the console with the cable’s small purple plug in it. Another player’s buttons arrive about one to two frames after they were pressed (your own are read straight from the buttons, with no delay), so the two consoles never agree to the frame. A player’s buttons are let go of, once, when they disappear, so "while the button is held" never gets stuck if the cable is pulled. A very short tap that arrives in the same frame as the next message still counts: pressed and released can both be true for it.

See also: link_button_heldlink_button_pressedbtn_releasedThe link cable